<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      let str = "hello ECMAscript 2015";
      //   startsWith()判断参数字符串是否在原字符串开头
      let r1 = str.startsWith("hello");
      //   endsWith()判断参数字符串是否在原字符串结尾
      let r2 = str.endsWith("2015");
      console.log(r1);
      console.log(r2);

      //   repeat方法将原字符串重复n次，返回一个新字符串
      let str2 = str.repeat(2);
      console.log(str2);
    </script>
  </head>
  <body></body>
</html>
